package com.lh.controller.center;

import com.lh.pojo.Users;
import com.lh.service.center.UserInfoService;
import com.lh.utils.IMOOCJSONResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: foodie-dev
 * @description:
 * @author: LH
 * @create: 2022-05-25 09:25
 **/
@Api(value = "个人信息相关接口", tags = {"个人信息相关api接口"})
@RestController
@RequestMapping("/center")
public class CenterController {

    @Autowired
    private UserInfoService userInfoService;

    @ApiOperation(value = "个人信息获取", notes = "个人信息获取", httpMethod = "GET",
            response = IMOOCJSONResult.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @GetMapping("/userInfo")
    public IMOOCJSONResult getUserInfo(
            @ApiParam(name = "用户Id", value = "用户Id", required = true)
            @RequestParam String userId
    ){

        Users userInfo = userInfoService.getUserInfo(userId);
        return IMOOCJSONResult.ok(userInfo);

    }

}
